package com.timo.redis.send;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Description: 类的详细说明
 * @Author: timo
 * @Date: 2019/8/28 17:58
 */
@Component
public class HelloSending {
    @Resource
    private RedisTemplate redisTemplate;

    private ChannelTopic topic = new ChannelTopic("/redis/pubsub");


    public void hello() {
        redisTemplate.convertAndSend("hello","hello timo love");
        redisTemplate.convertAndSend("timo","timo love");
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
